package com.study.jvm;

 class Father {

    int x = 10;

    public Father() {
        this.print();
        x = 20;

    }

    public void print() {
        System.out.println(this.x);

    }

}

class Son extends Father {
    int x = 30;

    public Son() {
        this.print();
        x = 40;

    }

    public void print() {
        System.out.println(this.x);

    }

}

public class SonTest {
    public static void main(String[] args) {
        Father f = new Son();

        System.out.println(f.x);
        try {

            Thread.sleep(20000);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}